#coding=utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')



class data_map(object):
    def __init__(self,data):
        self.data=data
        self.list1=[]

    def hour_data(self,city,begin_h,end_h):
        self.city=city
        self.begin_h=begin_h
        self.end_h=end_h

        for d in self.data:
            _dt=int(d[1])
            if self.city ==d[0] and _dt >= self.begin_h and _dt < self.end_h:
                self.list1.append(d)
        return self.list1

    def minute_date(self):
        self.list2=[]
           ##  5分钟，一小时 12个
        for n in xrange(0,12):
            s=0
            m_b=self.begin_h + n * 300
            m_e=self.begin_h + (n+1) * 300
            for i in self.list1:
                _dt=int(i[1])
                if _dt >= m_b and _dt < m_e:
                    s=s+1
            self.list2.append(s)
        return self.list2
